home *** CD-ROM | disk | FTP | other *** search
- Subject: RE>How to embed a part into yourself
- Sent: 6/14/96 5:37 AM
- Received: 6/14/96 9:17 AM
- From: Rob Cope, rob@eclipse.cpcn.com
- Reply-To: ODF Interest, ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
-
-
- Date: 6/13/96
- Subject: RE>How to embed a part into yourself Time: 8:52 PM
- >Can someone point me to sample code or a routine that shows how to create a
- >part at run-time and embed in another part. For example, in response to the
- >user choosing the text tool from a palette and dragging a rectangle, create
- >a text part and embed it at the location the user specified.
-
- Sorry I haven't tested this yet in R1, but I was planning on creating an embedded text part something like this
- (which is pretty much what the D11 Insert menu item did):
- ...
- ODPart* odEmbeddedPart;
- ODStorageUnit* su = fPart->GetStorageUnit(ev);
-
- // ----- Create part that edits type 'TEXT' using whatever editor user has set in Editor Setup -----
- ODValueType textKind = GetSession(ev)->GetTranslation(ev)->GetISOTypeFromPlatformType(ev, kTEXTOSType, kODPlatformDataType);
- odEmbeddedPart = su->GetDraft(ev)->CreatePart(ev, textKind, NULL);
- FW_ASSERT(odEmbeddedPart);
- odEmbeddedPart->Externalize(ev);
-
- // ----- Create the default frame shape -----
- FW_CAcquiredODShape frameShape = ::FW_NewODShape(ev, FW_CRect(FW_kZeroPoint, fNewPartSize));
-
- // ----- Embed the part -----
- fSelectionContent->SingleEmbeddedFrameInternalized(ev, fFrame, odEmbeddedPart,
- NULL,
- frameShape, fViewType);
-
- odEmbeddedPart->Release(ev);
- ...
-
- Does this seem like the right approach?
-
- Rob Cope
- Eclipse Services
-
-